<pre class="docs-method-signature"><code>link.attr(attrs, [, opt])</code></pre>

<p>Set presentation attributes (<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute">SVG</a> and <a href="joint.html#dia.attributes">JointJS </a> attributes) on subelements. This is a method analogous to <a href="#dia.Element.prototype.attr">attr</a> method of <code>joint.dia.Element</code>.  The keys of the <code>attrs</code> object are selectors (<a href="joint.html#dia.Cell.markup.json">JSON Markup Selector</a> or CSS Selector) matching the SVG element the link consists of. The values are objects containing SVG attributes and their values. <code>attrs</code> object will be mixed with <code>attrs</code> property of the <code>link</code> model. This is a convenient way of rewriting only some of the attributes of the SVG elements. For overwriting all attributes of all SVG elements, use <code>link.set('attrs', attrs)</code>.</p>

<pre><code>link.attr({
    // selector as defined in JSON markup
    line: {
        stroke: 'red',
        targetMarker: {
            type: 'circle',
            r: 5
        }
    }
});
</code></pre>

<pre class="docs-method-signature"><code>element.attr(path, value [, opt])</code></pre>

<p>An alternative call using a string path and a value:</p>
<pre><code>link.attr('line/stroke', 'red');
link.attr(['line', 'targetMarker', 'type'], 'path');
</code></pre>

<pre class="docs-method-signature"><code>element.attr([path])</code></pre>

<p>Get attribute value defined by a path. If no path provided the whole <code>attrs</code> object is returned.</p>

<pre><code>var color = link.attr('line/stroke');
var targetMarkerType = link.attr(['line', 'targetMarker', 'type']);
</code></pre>
